﻿using Pyxis.FluentSelenium.Conditions;
using Pyxis.FluentSelenium.Locator;

namespace Pyxis.FluentSelenium.SampleWebAppTest.Forum
{
    public static class PostListPage
    {
        public static IWaitCondition AppearCondition
        {
            get { return new PageLoadWaitCondition("Forum/AppPosts.aspx"); }
        }

        public static readonly ButtonLocator AddPostButton = ButtonLocator.WithId("newPost", NewPostPage.AppearCondition);
        public static readonly TableLocator AllPostsTable = TableLocator.Contains("grdPosts");
        public static readonly ButtonLocator SortAuthorButton = ButtonLocator.WithXpath("//a");
    }

    public static class NewPostPage
    {
        public static IWaitCondition AppearCondition
        {
            get { return new PageLoadWaitCondition("Forum/NewPost.aspx"); }
        }

        public static readonly InputLocator AuthorTextBox = InputLocator.Contains("txtAuthor");
        public static readonly InputLocator SubjectTextBox = InputLocator.Contains("txtSubject");
        public static readonly InputLocator MessagetTextBox = InputLocator.Contains("txtMessage");
        public static readonly ButtonLocator SavePostButton = ButtonLocator.Contains("btnSavePost", PostListPage.AppearCondition);
        public static readonly ButtonLocator SavePostButtonWithoutWait = ButtonLocator.Contains("btnSavePost");
        public static readonly ElementLocator AuthorRequiredMessage = ElementLocator.Contains("lblAuthorRequired");
    }
}
